<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>登录 - 织蝶云 - OA+PM+CRM一站式企业应用管理平台</title>
   <link rel="shortcut icon" href="./images/favicon/favicon.ico" type="image/x-icon">
   <link rel="stylesheet" href="./css/gy_resets.css">
   <link rel="stylesheet" href="./css/gy_login.css">
</head>

<body>
   <!-- 用户登录 -->
   <div class="form-login">
      <!-- 用户表单 -->
      <form action="" class="user-login">
         <!-- 用户登录上半部分 -->
         <div class="form-login-top">
            <!-- 图片 -->
            <img src="./images/gy/logo.png" alt="">
         </div>
         <!-- 用户登录中半部分  -->
         <div class="form-login-buttom">
            <input type="text" name="phone" placeholder="输入手机号/用户名" class="yonghu">
            <p class="form-login-buttom-block">请填写用户名</p>
            <input type="password" name="password" placeholder="请输入密码" class="miam">
            <p class="form-login-buttom-block">请填写密码</p>
            <button class="form-login-buttom-botton" type="button" class="loging">登录</button>
            <!-- 用户下半部分 -->
            <div class="form-login-up">
               <a href="javascript:;">产品介绍</a>&nbsp;&nbsp;
               <a href="javascript:;">帮助手册</a>&nbsp;&nbsp;
               <a href="javascript:;">联系我们</a><br>
               <span>还未加入我们<a href="/gy_register">注册</a></span>
            </div>
         </div>
      </form>
   </div>
   <script src="./lib/jquery/jquery.min.js"></script>
   <!-- <script src="./js/gy_login.js"></script> -->
   <script>
      $('.form-login-buttom-botton').on('click', function () {
         // console.log(123);
         let data = $('.user-login').serialize();
         // console.log(data);


         if ($('.yonghu').val() && $('.miam').val() != '') {
           
               $.ajax({
                  type: 'get',
                  url: '/userlogin',
                  data: data,
                  success: function (data) {
                     // console.log(data);
                     if (data.code == '1201') {
                        alert(data.message);
                        // return;
                     } else if (data.code == '1202') {
                        alert(data.message);
                        location.href = '/tmeplate';
                        $('.user-login button').html('成功登录')
                     }
                  }
               })
        
         } else {
            alert('请输入内容')
         }

      })
   </script>

</body>

</html>